package com.xjiye_test.payServer.servletGroup.weixin;

import com.xjiye_test.payServer.serverletUtil.ReadBytes;
import com.xjiye_test.payServer.serverletUtil.XMLParser;
import org.xml.sax.SAXException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Map;

/**
 * Created by Administrator on 2017/5/19.
 */
public class WeixinNotify extends HttpServlet {
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setCharacterEncoding("UTF-8");
        PrintWriter out = resp.getWriter();
        String reStr=null;
        req.setCharacterEncoding("UTF-8");
        int size = req.getContentLength();
        InputStream is = req.getInputStream();
//        try {
//            Map mapRequest = XMLParser.getMapFromXML(new String(ReadBytes.readBytes(is, size)));
//
//        } catch (ParserConfigurationException e) {
//            e.printStackTrace();
//        } catch (SAXException e) {
//            e.printStackTrace();
//        }
        System.out.println("收到回调:"+new String(ReadBytes.readBytes(is, size)));
        out.print("success");
        out.flush();
    }
}
